;;; core-obsolete.el --- Spacemacs Core File  -*- lexical-binding: t -*-
;;
;; Copyright (c) 2012-2025 Sylvain Benner & Contributors
;;
;; Author: Lin Sun <sunlin7 AT hotmail.com>
;; URL: https://github.com/syl20bnr/spacemacs
;;
;; This file is not part of GNU Emacs.
;;
;; This program is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or
;; (at your option) any later version.
;;
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
;; GNU General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with this program.  If not, see <http://www.gnu.org/licenses/>.

;;; Commentary:
;;
;; This file the obsolated viarables from Spacemacs, and detecting the variables
;; exists or not to give warnings to user.

;;; Code:

(defvar spacemacs-obsolete-variable-list
  '((dotspacemacs-command-key dotspacemacs-emacs-command-key "2016-01-09 (58e524)")
    (dotspacemacs-helm-no-header helm-no-header "2018-06-08")
    (dotspacemacs-helm-position helm-position "2018-06-08")
    (dotspacemacs-remap-Y-to-y$ vim-style-remap-Y-to-y$ "2018-06-08")
    (dotspacemacs-retain-visual-state-on-shift vim-style-retain-visual-state-on-shift "2018-06-08")
    (dotspacemacs-visual-line-move-text vim-style-visual-line-move-text "2018-06-08")
    (dotspacemacs-ex-substitute-global vim-style-ex-substitute-global "2018-06-08")
    (hybrid-mode-default-state hybrid-style-default-state "2018-06-08")
    (hybrid-mode-enable-hjkl-bindings hybrid-style-enable-hjkl-bindings "2018-06-08")
    (hybrid-mode-enable-evilified-state hybrid-style-enable-evilified-state "2018-06-08")
    (hybrid-mode-use-evil-search-module hybrid-style-use-evil-search-module "2018-06-08")
    (dotspacemacs-helm-use-fuzzy helm-use-fuzzy "2018-06-08")
    (dotspacemacs-helm-resize helm-enable-auto-resize "2018-06-08")))
(defun spacemacs//check-obsolete-variables ()
  "Check for defined obsolete variables and return a list of warning messages."
  ;; Filter out all 'nil' values generated by the mapcar.
  ;; `seq-remove` is preferred over the older `cl-remove-if #'null`.
  (seq-remove #'null
              (mapcar (lambda (item)
                        (cl-destructuring-bind (obsolete-name new-name since) item
                          (when (boundp obsolete-name)
                            (let ((suggestion
                                   (if (string-prefix-p "hybrid-mode-" (symbol-name obsolete-name))
                                       "  (try updating the `hybrid-mode' package with \\[configuration-layer/update-packages])"
                                     "")))
                              (substitute-command-keys
                               (format "`%s' is obsolete since %s, use `%s' instead.%s"
                                       obsolete-name since new-name suggestion))))))
                      spacemacs-obsolete-variable-list)))

(provide 'core-obsolete)

;;; core-obsolete.el ends here
